package cn.edu.scut.sys.vo;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.edu.scut.sys.json.CustomTimestampSerializer;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * TrainScore entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "train_score", catalog = "scoredb")
@JsonIgnoreProperties(value={"hibernateLazyInitializer"})
public class TrainScore implements java.io.Serializable {

	private static final long serialVersionUID = 9077377371828342809L;

	// Fields

	private Long id;
	private Leader leader;
	private Student student;
	private Timestamp trainDate;
	private Integer score;

	// Constructors

	/** default constructor */
	public TrainScore() {
	}

	/** full constructor */
	public TrainScore(Leader leader, Student student, Timestamp trainDate,
			Integer score) {
		this.leader = leader;
		this.student = student;
		this.trainDate = trainDate;
		this.score = score;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "leaderId")
	public Leader getLeader() {
		return this.leader;
	}

	public void setLeader(Leader leader) {
		this.leader = leader;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "studentId")
	public Student getStudent() {
		return this.student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	@Column(name = "trainDate", length = 19)
	@JsonSerialize(using=CustomTimestampSerializer.class)
	public Timestamp getTrainDate() {
		return this.trainDate;
	}

	public void setTrainDate(Timestamp trainDate) {
		this.trainDate = trainDate;
	}

	@Column(name = "score")
	public Integer getScore() {
		return this.score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

}